package com.poizon.infrastructure.idem.core.annoations.config;

import com.poizon.infrastructure.idem.core.annoations.aop.AntiSubmitAspect;
import com.poizon.infrastructure.idem.core.annoations.aop.IdempotentAspect;
import com.poizon.infrastructure.idem.core.util.IIdemUtil;
import com.poizon.infrastructure.idem.core.util.IRepeatedSubmitUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;

@Slf4j
public class AopConfig {
    @Bean
    public IdempotentAspect initIdempotentAspect(IIdemUtil idemUtil) {
        log.info(">成功初始化幂等切面");
        return new IdempotentAspect(idemUtil);
    }
    @Bean
    public AntiSubmitAspect initAntiSubmitAspect(IRepeatedSubmitUtil repeatedSubmitUtil) {
        log.info(">成功初始化防重复提交切面");
        return new AntiSubmitAspect(repeatedSubmitUtil);
    }

}
